﻿Public Class clsScheduleInfos

    Public count As Int32
    Public maxres() As Int32
    Public odiagram()()() As Int32
    Public actMaxResource()() As Int32
    Public actPeakResource()() As Int32
    ' Dim ResourceSchedule(projInfo.MPMTime * 5) As HashSet(Of Int32)

    Public Function Init(ByVal projinfo As clsProject, ByRef diagrams As Dictionary(Of String, Int32()()), Optional ByVal bTakeFromParent As Boolean = False) As Boolean
        Try
            Dim len As Int32 = projinfo.MPMTime * 6
            Dim i As Int32 = 0
            For Each res As String In projinfo.RenewableResources.Keys
                Dim diagram(projinfo.RenewableResources(res) - 1)() As Int32
                If document Then
                    For x = 0 To projinfo.RenewableResources(res) - 1
                        Dim cols(projinfo.MPMTime * 6) As Int32
                        diagram(x) = cols

                    Next
                End If
                Dim maxResource(len) As Int32
                Dim peakResource(len) As Int32
          
                Dim j As Int32 = 0
                If bTakeFromParent Then
                    For Each time As Int32 In projinfo.PeakResource(i)
                        peakResource(j) = time
                        j += 1
                    Next

                End If
                actMaxResource(i) = maxResource
                actPeakResource(i) = peakResource
                If document Then
                    diagrams.Add(res, diagram)
                    odiagram(i) = diagram
                End If
                maxres(i) = projinfo.RenewableResources(res) ' - 1
                i += 1
            Next

            Return True
        Catch ex As Exception
            Throw
        End Try
    End Function


    Public Sub New(ByVal projinfo As clsProject)
        Try
            count = projinfo.RenewableResources.Keys.Count - 1
            ReDim maxres(count)
            ReDim odiagram(count)
            ReDim actMaxResource(count)
            ReDim actPeakResource(count)
        Catch ex As Exception
            Throw
        End Try

    End Sub
End Class
